#pragma once
#include<mutex>
#include<condition_variable>
#include<thread>
#include<queue>

template<class T>
class LockQueue
{
public:
  LockQueue(){}
  void Push(T val)
  {
    std::unique_lock<std::mutex> lock(m_mutex);
     m_queue.push(val);
     m_conditionVariable.notify_one();
  }
  T Pop()
  {
     std::unique_lock<std::mutex> lock(m_mutex);
     while(m_queue.empty())
     {
       m_conditionVariable.wait(lock);
     }
     T val = m_queue.front();
     m_queue.pop();
     return val;
  }

private:
 std::queue<T> m_queue;
 std::mutex m_mutex;
 std::condition_variable m_conditionVariable;
};